package main

import (
	"fmt"
	"last/app/middlewares/cors"
	"last/bootstrap"

	"github.com/gin-gonic/gin"
	"github.com/spf13/cast"
	"github.com/spf13/viper"
)

func main() {
	route := gin.New()

	//跨域中间件
	route.Use(cors.Cors())

	// 初始化 数据库
	bootstrap.SetupDB()

	bootstrap.SetupLogger()

	//初始化 路由
	bootstrap.SetupRoute(route)
	err := route.Run(":"+cast.ToString(viper.Get("app_prot")))
	if err != nil {
		fmt.Println(err.Error())
	}
}
